package ui;

import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.BorderFactory;
import javax.swing.border.BevelBorder;
import javax.swing.border.CompoundBorder;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Dimension;
import static constants.GTextbookConstants.*;

import javax.swing.Box;

public class StatusBar extends JPanel {
  // Constructor
  public StatusBar() {
    setLayout(new FlowLayout(FlowLayout.LEFT, 10, 5));    
    //setBackground(Color.LIGHT_GRAY);
    //setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY));
    setBorder(new CompoundBorder(
           BorderFactory.createLineBorder(Color.black, 1),         // Outer border
           BorderFactory.createBevelBorder(BevelBorder.RAISED))); 

    add(defNumPane);
    
    add(Box.createHorizontalStrut(10)); 

                  add(stepNumPane);          
  }

  public void setDefNumPane(int defNum){
     defNumPane.setText("Def. Num. " + defNum);
     if(language.getNum() == English){
    	 defNumPane.setFont(Status_English_Font);
     }else
         if(language.getNum() == Chinese){
        	 defNumPane.setFont(Status_Chinese_Font);
         }
     defNumPane.setPreferredSize(new Dimension(150,20)); 
  }
  
  public void setStepNumPane(int defNum){
	  stepNumPane.setText("Simplification Steps: " + defNum);
	     if(language.getNum() == English){
	    	 stepNumPane.setFont(Status_English_Font);
	     }else
	         if(language.getNum() == Chinese){
	        	 stepNumPane.setFont(Status_Chinese_Font);
	         }
	  stepNumPane.setPreferredSize(new Dimension(200,20)); 
	  }
  

  // Panes in the status bar

  private StatusPane defNumPane = new StatusPane();
  private StatusPane stepNumPane = new StatusPane();

  // Class defining a status bar pane
  class StatusPane extends JLabel {
    public StatusPane() {
      setBackground(Color.LIGHT_GRAY);      // Set background color
      setForeground(Color.BLACK);                   // Set the fixed font
      setHorizontalAlignment(CENTER);      // Center the pane text 
      setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
      setPreferredSize(new Dimension(100,20));                      // Set the text in the pane
    }
  }
}

